#include "../os_env.h"
#include <string.h>

#ifdef _MSC_VER
#include <windows.h>
#else 
#include <unistd.h>
#include <pthread.h>
#endif

#define MAX_PATH 260

char * os_get_temp_path()
{
	static char s_winTmpPath[MAX_PATH + 1] = {0};
	unsigned long dwRetVal = 0;

	if(strlen(s_winTmpPath) > 0)
	{
		return s_winTmpPath;
	}

#ifdef _MSC_VER
	strcpy(s_winTmpPath, "d:\\");
#else 
	strcpy(s_winTmpPath, "/var/tmp/");
#endif
	

	return s_winTmpPath;
}

unsigned long os_get_current_process_id()
{
#ifdef _MSC_VER
	return GetCurrentProcessId();
#else 
	return getpid();
#endif
}

unsigned long os_get_current_thread_id()
{
#ifdef _MSC_VER
	return GetCurrentThreadId();
#else 

	pthread_t thread_id = pthread_self();
	unsigned long  tid = (unsigned long)thread_id;
	return tid;

#endif

}

char * os_get_current_module_name()
{
	static char s_moduleName[MAX_PATH + 1] = {0};	
	return s_moduleName;
}

int os_is_bad_read_ptr(void *handle)
{
	return 0;
}

unsigned long os_get_last_error()
{
	return 0;
}

void os_set_last_error(unsigned long err_no)
{
	return ;
}